﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IResolverAdditionalMethodsNet45.cs" company="Rolosoft Ltd">
//   © Rolosoft Ltd
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

#region License

// Copyright 2013 Rolosoft Ltd
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion

namespace Rsft.Net.Dns.Interfaces
{
    #region Usings

    using System.Diagnostics.Contracts;
    using System.Net;
    using System.Threading;
    using System.Threading.Tasks;

    using Rsft.Net.Dns.Entities;

    #endregion

    /// <summary>
    /// The ResolverAdditionalMethodsNet45 interface.
    /// </summary>
    [ContractClass(typeof(ResolverAdditionalMethodsNet45Contracts))]
    public interface IResolverAdditionalMethodsNet45
    {
        #region Public Methods and Operators

        /// <summary>
        /// The get host addresses async.
        /// </summary>
        /// <param name="hostNameOrAddress">
        /// The host name or address.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress, CancellationToken cancellationToken);

        /// <summary>
        /// The get host by address async.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> GetHostByAddressAsync(IPAddress address, CancellationToken cancellationToken);

        /// <summary>
        /// The get host by address async.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> GetHostByAddressAsync(string address, CancellationToken cancellationToken);

        /// <summary>
        /// The get host by name async.
        /// </summary>
        /// <param name="hostName">
        /// The host name.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> GetHostByNameAsync(string hostName, CancellationToken cancellationToken);

        /// <summary>
        /// The get host entry async.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> GetHostEntryAsync(IPAddress address, CancellationToken cancellationToken);

        /// <summary>
        /// The get host entry async.
        /// </summary>
        /// <param name="hostNameOrAddress">
        /// The host name or address.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> GetHostEntryAsync(string hostNameOrAddress, CancellationToken cancellationToken);

        /// <summary>
        /// The query async.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="queryType">The query type.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="queryClassType">The query class type.</param>
        /// <returns>
        /// The <see cref="Task" />.
        /// </returns>
        Task<Response> QueryAsync(
            string name, QType queryType, CancellationToken cancellationToken, QClassType queryClassType = QClassType.IN);

        /// <summary>
        /// The resolve async.
        /// </summary>
        /// <param name="hostName">
        /// The host name.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IPHostEntry> ResolveAsync(string hostName, CancellationToken cancellationToken);

        #endregion
    }
}